home *** CD-ROM | disk | FTP | other *** search
/ Armageddon - Interactive Preview / Interactive Preview: Armageddon.iso / pc / control.dxr / Scripts & Behaviors_19_aDisplayObj.ls < prev    next >
Encoding:
Text File  |  1998-05-19  |  2.0 KB  |  92 lines

  1. property pStartDigit, pDay, PHr, pMin, pSec, pThisTime
  2. global gCountEnd
  3.  
  4. on new me, startDigit
  5.   set pStartDigit to startDigit
  6.   set pDay to string(12)
  7.   set PHr to string(random(23))
  8.   set pMin to string(random(59))
  9.   set pThisTime to the timer
  10.   adjustTime(me)
  11.   return me
  12. end
  13.  
  14. on adjustTime me
  15.   if the number of chars in pDay = 1 then
  16.     put 0 before pDay
  17.   end if
  18.   if the number of chars in PHr = 1 then
  19.     put 0 before PHr
  20.   end if
  21.   if the number of chars in pMin = 1 then
  22.     put 0 before pMin
  23.   end if
  24. end
  25.  
  26. on setDisplay me
  27.   if the puppet of sprite pStartDigit = 0 then
  28.     startPuppets(me)
  29.   end if
  30.   set thisSprite to pStartDigit
  31.   repeat with x = 1 to 2
  32.     set thisCast to string(char x of pDay)
  33.     set the member of sprite thisSprite to thisCast
  34.     set thisSprite to thisSprite + 1
  35.   end repeat
  36.   repeat with x = 1 to 2
  37.     set thisCast to string(char x of PHr)
  38.     set the member of sprite thisSprite to thisCast
  39.     set thisSprite to thisSprite + 1
  40.   end repeat
  41.   repeat with x = 1 to 2
  42.     set thisCast to string(char x of pMin)
  43.     set the member of sprite thisSprite to thisCast
  44.     set thisSprite to thisSprite + 1
  45.   end repeat
  46.   updateStage()
  47. end
  48.  
  49. on updateDisplay me
  50.   if the timer > (pThisTime + 60) then
  51.     set pThisTime to the timer
  52.     set pDay to value(pDay)
  53.     set PHr to value(PHr)
  54.     set pMin to value(pMin)
  55.     set pMin to pMin - 1
  56.     if (pMin = 0) and (PHr = 0) and (pDay = 0) then
  57.       set gCountEnd to 1
  58.       go(1, "COUNTEND")
  59.       stopEvent()
  60.       exit
  61.     end if
  62.     if pMin = 0 then
  63.       set pMin to 59
  64.       set PHr to PHr - 1
  65.     end if
  66.     if (PHr = 0) and (pDay > 0) then
  67.       set PHr to 59
  68.       set pDay to pDay - 1
  69.     else
  70.       if PHr = 0 then
  71.         nothing()
  72.       end if
  73.     end if
  74.     if pDay < 0 then
  75.       set pDay to 0
  76.     end if
  77.     set pDay to string(pDay)
  78.     set PHr to string(PHr)
  79.     set pMin to string(pMin)
  80.     adjustTime(me)
  81.     setDisplay(me)
  82.   end if
  83. end
  84.  
  85. on startPuppets me
  86.   set thisSprite to pStartDigit
  87.   repeat with x = 1 to 6
  88.     puppetSprite(thisSprite, 1)
  89.     set thisSprite to thisSprite + 1
  90.   end repeat
  91. end
  92.